<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class CreateRedEnvelopesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('red_envelopes', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->comment('发包用户ID');
            $table->integer('balance')->comment('红包金额');
            $table->integer('refund')->comment('超时退款金额');
            $table->integer('count')->comment('红包个数');
            $table->integer('status')->comment('状态：1正常，2过期，3关闭');
            $table->integer('to_user_id')->default(0)->comment('指定用户ID');
            $table->timestamps();
        });
        DB::statement("alter table `red_envelopes` comment'用户红包表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('red_envelopes');
    }
}
